﻿/**********************************************************************
*创建人：蔡水明
*创建时间：2018/4/3 13:43:28
*说明：<Function>
/**********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Utilities
{
    /// <summary>
    /// 版本号处理类
    /// </summary>
    public class VerHelper
    {
        private const int MaxVerCount = 10;
        /// <summary>
        /// 版本增长
        /// </summary>
        /// <returns></returns>
        public static Version VerIncrease(Version oldVer)
        {
            int major = oldVer.Major;
            int minvor = oldVer.Minor;
            int build = oldVer.Build;
            int revision = oldVer.Revision;
            int max = revision + build * MaxVerCount + minvor * MaxVerCount * MaxVerCount + major * MaxVerCount * MaxVerCount * MaxVerCount;
            max++;
            string maxStr = max.ToString("D4");
            return new Version($"{maxStr[0]}.{maxStr[1]}.{maxStr[2]}.{maxStr[3]}");
        }
    }
}
